package com.yifi.common.plugins.shiro;

import com.jfinal.config.Routes;
import com.jfinal.plugin.IPlugin;
import org.apache.shiro.web.mgt.DefaultWebSecurityManager;

/**
 * @author 姚善利
 * @classname com.yifi.common.plugins.Shrio
 * @description   shrio插件
 * @date 2022/12/15 10:50
 */
public class ShiroPlugin implements IPlugin {

    private Routes routes;
    public ShiroPlugin(Routes _routes)
    {
        this.routes=_routes;
    }

    @Override
    public boolean start() {
        UserRealm userRealm = new UserRealm();
        DefaultWebSecurityManager securityManager = new DefaultWebSecurityManager();
        // 设置realm.
        securityManager.setRealm(userRealm);

        return true;
    }

    @Override
    public boolean stop() {
        return false;
    }
}
